1. Field of the Invention
In general, the present invention provides a method, system and program product for interning invariant data objects in dynamic space constrained systems. Specifically, the present invention provides a system for efficiently tracking and reusing invariant data objects at runtime.
2. Related Art
In programs, invariant data typically consumes a significant amount of memory. Invariant data is data that is known to never change. Examples of invariant data objects include method names, data strings within methods, etc. When a program component (e.g., class file) is loaded, all of its members must be copied into runtime structures. Some of these members are variant (e.g. class field slots), and others are invariant (e.g. method names).
To reduce the amount of memory space required, modern compilers remove duplicate invariant data objects. Dynamic systems, where the components of a program are gathered together at runtime, present certain difficulties. Specifically, when done at compile time, there are few time or memory constraints. However, at runtime, both time and space must be conserved since excessive use of either may have a negative impact on the program being executed. An additional complication for dynamic systems is that they may not rely on whole-program analysis. Instead, the system must dynamically adjust its invariant interning mechanisms. An additional complication posed by dynamic systems is the issue of component unloading. Specifically, in a dynamic system, certain components may be removed from the system (e.g., Class unloading in Java). To this extent, the interning mechanism should ensure that no unloaded invariant is required by the components that are still loaded.
Unfortunately, no existing system provides an efficient way to intern invariant data objects while ensuring that the memory space and time consumed by the interning mechanism does not exceed any savings generated thereby. In view of the foregoing, there exists a need for a method, system and program product for interning invariant data objects in dynamic space constrained systems. Specifically, a need exists for an interning mechanism that can track and reuse invariant data objects. A further need exists for such a system to impose restrictions on the amount of memory space used, and the amount of time incurred by interning invariant data at runtime.